import request from '@/utils/request'
import qs from 'qs'

const headers = {
  'Content-Type': 'application/x-www-form-urlencoded'
}

// 查看文章
export function Article(data) {
  return request({
    url: '/generator/info/listInfo',
    method: 'post',
    data: qs.stringify(data),
  })
}
// 新增文章
export function addMent(data) {
  return request({
    url: '/generator/info/addInfo',
    method: 'post',
    data: qs.stringify(data),
  })
}
// 修改文章
export function modifyArt(data) {
  return request({
    url: '/generator/info/upInfo',
    method: 'post',
    data: qs.stringify(data),
  })
}
// 删除文章
export function deleart(data) {
  return request({
    url: '/generator/info/delInfo',
    method: 'post',
    data: qs.stringify(data),
  })
}
// 文章详情
export function articleDeta(data) {
  return request({
    url: '/generator/info/getById',
    method: 'post',
    data
  })
}
// 查看评论
export function Comment(data) {
  return request({
    url: '/generator/comment/listComment',
    method: 'post',
    data: qs.stringify(data),
  })
}
// 新增评论
export function AddAReview(data) {
  return request({
    url: '/generator/comment/addComment',
    method: 'post',
    data: qs.stringify(data),
  })
}
// 删除评论
export function deleteCom(data) {
  return request({
    url: '/generator/comment/delComment',
    method: 'post',
    data: qs.stringify(data),
  })
}
//点赞
export function Bitter(data) {
  return request({
    url: '/generator/favorite/addCollection?type=1',
    method: 'post',
    data: qs.stringify(data),
  })
}
//收藏
export function Collect(data) {
  return request({
    url: '/generator/favorite/addCollection?type=2',
    method: 'post',
    data,
  })
}
// 查看点赞收藏
export function Check(data) {
  return request({
    url: '/generator/favorite/list',
    method: 'post',
    data: qs.stringify(data),
  })
}
// 删除点赞收藏
export function deletea(data) {
  return request({
    url: '/generator/favorite/delfavorite',
    method: 'post',
    data: qs.stringify(data),
  })
}
// 栏目查看
export function columnView(data) {
  return request({
    url: '/generator/node/list',
    method: 'post',
    data,
  })
}
// 栏目新增
export function NewColumn(data) {
  return request({
    url: '/generator/node/addNode',
    method: 'post',
    data: qs.stringify(data),
  })
}
// 栏目修改
export function columnMod(data) {
  return request({
    url: '/generator/node/updateNode',
    method: 'post',
    data,
  })
}
// 栏目删除
export function columnDelete(data) {
  return request({
    url: '/generator/node/delNode',
    method: 'post',
    data:qs.stringify(data),
  })
}
// 标签查看
export function tagView(data) {
  return request({
    url: '/generator/tag/listTag',
    method: 'post',
    data,
  })
}
// 标签增加
export function tagIncrease(data) {
  return request({
    url: '/generator/tag/addTag',
    method: 'post',
    data,
  })
}
// 标签删除
export function tagDelete(data) {
  return request({
    url: '/generator/tag/delTge',
    method: 'post',
    data,
  })
}
// 图片上传
export function pictureUp(data) {
  return request({
    url: '/generator/upload/upload',
    method: 'get',
    data,
    headers: {
      'Content-Type': 'multipart/form-data' // 默认值
    },
  })
}
// 邮件查询
export function mailQuery(data) {
  return request({
    url: '/generator/mail/listMailMessage',
    method: 'get',
    params: data,
  })
}
// 回复邮件
export function reply(data) {
  return request({
    url: 'generator/mail/updateMailMessage',
    method: 'post',
    params: data,
  })
}
